#define _CRT_SECURE_NO_WARNINGS 1
#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<string.h>
char* reverse(char* s, int start, int end)
{
    while (start < end)
    {
        char tem = s[start];
        s[start++] = s[end];
        s[end--] = tem;
    }
    return s;
}
char* reverseLeftWords(char* str, int n)
{
    int len = strlen(str);
    str = reverse(str, 0, n - 1);
    str = reverse(str, n, len - 1);
    str = reverse(str, 0, len - 1);
    return str;
}
int judge(char* str, char* s)
{
    int len = strlen(s);
    for (int i = 1; i < len; i++)
    {
        reverseLeftWords(str, i);
        if (strcmp(str, s) == 0)
            return 1;
    }
    return 0;

}
int main()
{
    char str[] = "ABCDA";
    char qtr[] = "BCDAT";
    if (judge(str, qtr)==1)
        printf("Yes\n");
    else
        printf("No\n");
}